package team.pwy.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
import team.pwy.pojo.entity.Message;

import java.util.List;

@Repository
public interface MessageMapper {

    @Select("select * from pwy.pwy_message where user_id = #{userId} and status = #{status} order by create_time desc")
    List<Message> findByStatus(Integer userId,Integer status);

    Integer updateByLook(List<Integer> messageIds);

    @Update("update pwy.pwy_message set status = 0 where user_id = #{userId} and status = 2")
    Integer updateByLookReal(Integer userId);

    @Select("select * from pwy.pwy_message where user_id = #{value} order by create_time desc")
    List<Message> findAllMsg(Integer userId);
}
